{template header}
<style type="text/css">
    body{ background-color: #fff; }
    .sfz_box img{ max-height: 167px; }
    .tips{ padding: 10px; background-color: #FEF8B6; font-size: 14px; }
</style>
<body>
    <!-- S header -->
    <header class="alliance_details_header">
        <a href="javascript:;" onClick="javascript :history.back(-1);" class="headerL iconfont">&#xe66a;</a>
        <h1>申请盟主</h1>
    </header>
    <!-- E header -->

    <?php 
    if($info['union_status']==='0'){?>
        <div class="tips">已经提交申请，等待管理审核</div>
    <?php } ?>

    <?php 
    if($info['union_status']==='2'){?>
        <div class="tips"><?php echo $info['deal_info']?></div>
    <?php } ?>

    <form class="registerform" action="{U('User/index/unionin')}" method="post" >
    <ul class="alliance_items">
        <li>
            <label class="label">联盟名称</label>
            <input type="text" placeholder="请输入联盟的名称" name="union_name" datatype="*" value="<?php echo $info['union_name']?>"  nullmsg='请输入联盟的名称'  class="input">
        </li>
        <li>
            <label class="label">联盟盟主</label>
            <input type="text" placeholder="请输入盟主的昵称" readonly value="<?php echo $this->userinfo['username']?>" class="input">
        </li>
        <li>
            <label class="label">联盟宣言</label>
            <textarea placeholder="请输入联盟宣言"  name="content" datatype="*"   nullmsg='请输入联盟宣言'  class="textarea"><?php echo $info['content']?></textarea>
        </li>
    </ul>
    </form>
    <a href="javascript:;" class="alliance_sqBtn" onclick="submitForm();">申请</a>
</body>
<script type="text/javascript">
    function submitForm(){
        layer.open({type: 2});
        $(".registerform").submit();
    }
    $(".registerform").Validform({
            tiptype:function(msg,o,cssctl){
                if(o.type==3){
                    layer.closeAll();
                    //$(".errmsg").text(msg).show();
                    tips(msg);
                    return false;
                }
                if(o.type==1){
                    o.obj.addClass("Validform_success")
                }
            },
            ajaxPost: true,
            callback: function(ret) {
                layer.closeAll();
                if (ret.status == 0) {
                    hd_alert(ret.info);
                } else {
                    tips(ret.info,"/index.php?m=user&c=index&a=unionin");
                }
            }
    });
</script>
</html>